package com.hxkj.controller.userCenter;

import com.github.pagehelper.PageInfo;
import com.hxkj.domain.po.SystemMessageSend;
import com.hxkj.service.userCenter.SystemMessageSendService;
import com.platform.common.domain.to.PageTo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.Callable;

@RestController
@RequestMapping(value = "/systemMessageSend")
public class SystemMessageSendController {

    @Autowired
    private SystemMessageSendService systemMessageSendService;

    @RequestMapping(value = "/sendMessageToAll")
    public void sendMessageToAll(@ModelAttribute SystemMessageSend systemMessageSend) throws Exception{
        systemMessageSendService.sendMessageToAll(systemMessageSend);
    }

    @RequestMapping(value = "/getSystemMessageSendInfo")
    public Callable<SystemMessageSend> getSystemMessageSendInfo(@ModelAttribute SystemMessageSend systemMessageSend) throws Exception{
        return () -> systemMessageSendService.getSystemMessageSendInfo(systemMessageSend);
    }

    @RequestMapping(value = "/getList")
    public Callable<PageInfo<SystemMessageSend>> getList(@ModelAttribute SystemMessageSend systemMessageSend, @ModelAttribute PageTo pageParam) throws Exception{
        return () -> systemMessageSendService.getList(systemMessageSend == null ? new SystemMessageSend() : systemMessageSend , pageParam);
    }

    @RequestMapping(value = "/deleteSendMessage")
    public void deleteSendMessage(String messageIds) throws Exception{
        systemMessageSendService.deleteSendMessage(messageIds);
    }
}
